<?php
function showNavigation($file,$section,$assetDetails,$profilingId){
	
	$tag=isset($assetDetails['tag']) ? $assetDetails['tag'] : NULL;
	$motorId=isset($assetDetails['id']) ? $assetDetails['id'] : NULL;
	$links=NULL;
	switch($file){
		case 'dashboard':
			$links[] = ["display"=>"Dashboard","href"=>""];
		break;
		case "faq":
				$links[] = ["display"=>"FAQ","href"=>""];
		break;
		case 'motors':
				$section=isset($section) ? $section : 'motorList';
				switch($section){
					case "motorList":
							$links[] = ["display"=>"Home","href"=>""];
					break;
					
					case "dataList":
						$links[] = ["display"=>"Home","href"=>"motors.php"];
						$links[] = ["display"=>"Data List #{$tag}","href"=>""];
					break;
					
					case "profillingSummary":
						$links[] = ["display"=>"Home","href"=>"motors.php"];
						$links[] = ["display"=>"Motor #{$tag}","href"=>"motors.php?section=dataList&motorId={$motorId}"];
						$links[] = ["display"=>"Profiling Summary #{$profilingId}","href"=>""];
					break;
					
					case "profilingErrorDetails":
						$links[] = ["display"=>"Home","href"=>"motors.php"];
						$links[] = ["display"=>"Motor #{$tag}","href"=>"motors.php?section=dataList&motorId={$motorId}"];
						$links[] = ["display"=>"Profiling run errors","href"=>""];
					break;
					
				}
		break;
		
		case 'addMotor':
			$links[] = ["display"=>"Add Motor","href"=>""];
		break;
		
		case 'swapMotor':
			$links[] = ["display"=>"Swap Motor","href"=>""];
		break;
		
		case 'adminPanel':
			$subSection=isset($_REQUEST['sub']) ? $_REQUEST['sub'] : "addUser";
			switch($subSection){
					case "addUser":
							$links[] = ["display"=>"Admin Panel","href"=>"adminPanel.php"];
							$links[] = ["display"=>"Add User","href"=>""];	
					break;
					case "editUser":
							$userToEdit=isset($_REQUEST["userToEdit"]) ? $_REQUEST["userToEdit"] : NULL;
							if(isset($userToEdit)){
								$userName=Users::gerUserNameFromId($userToEdit);
								$links[] = ["display"=>"Admin Panel","href"=>"adminPanel.php"];
								$links[] = ["display"=>"User Table","href"=>"adminPanel.php?sub=editUser"];	
								$links[] = ["display"=>"Edit User : {$userName}","href"=>""];	
							}
							else{
								$links[] = ["display"=>"Admin Panel","href"=>"adminPanel.php"];
								$links[] = ["display"=>"User Table","href"=>""];	
							}
					break;
				} 
			
		break;
		
		case 'reports':
			$links[] = ["display"=>"Reports","href"=>""];
		break;
		
		case 'default':
			$links[] = ["display"=>"","href"=>""];
		break;
	
	}
	$navBuildHtml="<i style='color:#00BA8B;' class='icon-large icon-home'></i> > ";
		foreach($links as $v){
			$href="href={$v["href"]}";
			$style="style=text-decoration:underline;";
			if($v['href']==""){
				$href='nohref';
				$style="style=text-decoration:underline";
			}
			$display=$v["display"];
			$separator = ($v==end($links)) ? "" : " <span style='padding:5px'> > </span> ";
			$class=($v==end($links)) ? "active" : "";
			$navBuildHtml.="<li class='$class'><a {$href} {$style} title='{$display}'> {$display} </a> ".$separator."</li>";
		}
	$html='<ol class="breadcrumb">';
	$html.=$navBuildHtml;
	$html.='</ol>';
	echo $html;

}

?>